//
//  BannerDetailViewController.m
//  VTravel
//
//  Created by lanouhn on 16/8/4.
//  Copyright © 2016年 xiaoYu. All rights reserved.
//

#import "BannerDetailViewController.h"

@interface BannerDetailViewController ()

@property (strong, nonatomic) IBOutlet UIWebView *webView;

@property (nonatomic, copy) NSString *content;

@end

@implementation BannerDetailViewController

#pragma mmark - 请求公告详情数据
- (void)requestData{
    [NetWorkManager requestForGETWithURL:StrByAppendStr(StrByAppendStr(KBannerDetailURL, @"/"), self.bannerNews_id) paramater:nil success:^(id responseObject) {
        
        NSString *content = responseObject[@"data"][@"content"];
        
//        NSURL *url = [NSURL URLWithString: content];
        
//        NSURLRequest *request = [NSURLRequest requestWithURL:url];
        
        dispatch_async(dispatch_get_main_queue(), ^{
            // 加载一个请求
            [self.webView loadHTMLString:content baseURL:nil];
        });

        
    } fail:^(NSError *error) {
        kMyLog(@"%@", error);
    }];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"公告详情";
    
    dispatch_async(dispatch_get_global_queue(0, 0), ^{
        [self requestData];
    });

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
